package com.syp.auth.export.util;

import java.lang.reflect.Method;

import javax.servlet.http.HttpServletRequest;

import org.springframework.web.method.HandlerMethod;

import com.syp.auth.export.annotation.SecurityNone;

public class SecurityExcluder {

	public static final boolean process(HttpServletRequest request, Object handler, String[] excludeUriPatterns) {
		if (RequestExcluder.process(request, excludeUriPatterns)) {
			return true;
		}

		if (handler instanceof HandlerMethod) {
			HandlerMethod handlerMethod = (HandlerMethod) handler;
			Method method = handlerMethod.getMethod();
			SecurityNone sno = method.getAnnotation(SecurityNone.class);

			if (sno != null) {
				return true;
			}
		}

		return false;
	}

}
